
package com.loan.rebate.index.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.loan.rebate.common.controller.BaseController;
import com.loan.rebate.news.entity.NewsInfoVO;
import com.loan.rebate.news.param.NewsInfoParam;
import com.loan.rebate.news.service.NewsInfoService;

/**
 * 首页
 *
 * @author 朱国军
 * @since 1.0
 * @version 2016年4月4日 朱国军
 */
@Controller
public class IndexController extends BaseController {

    @Autowired
    private NewsInfoService newsInfoService;
    
    private final static String INDEX_PAGE = "/index";

    /**
     * 首页请求
     *
     * @return 返回首页页面
     */
    @RequestMapping(value = "/")
    public ModelAndView index() {
        Map<String, Object> resultMap = new HashMap<String, Object>();
        
        NewsInfoParam newsInfoParam = new NewsInfoParam();
        newsInfoParam.setPageSize(10);
        newsInfoParam.setPageNo(1);
        newsInfoParam.setNewsStatus(2);
        newsInfoParam.setNewsType(1);
        List<NewsInfoVO> dataList = newsInfoService.queryByPage(newsInfoParam);
        resultMap.put("dataList", dataList);
        resultMap.put("paramMap", newsInfoParam);

        return new ModelAndView(INDEX_PAGE, resultMap);
    }
}
